package com.hsylient.javase.chapter09;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

import java.math.BigDecimal;
import java.util.function.BiFunction;
import java.util.function.Function;

@Slf4j
public class FunctionTest {


    @Test
    public void testFunction() {
        String result = function((id, salary) -> id + salary.toString(), 11, BigDecimal.TEN);
        log.info("[方法引用] 方法引用的结果 {}", result);
    }

    public String function(BiFunction<Integer, BigDecimal, String> function,
                           Integer age,
                           BigDecimal salary) {
        return function.apply(age, salary);
    }



    @Test
    public void testConsumerFunction() {
        String result = testUseFunction("hsylient", String::toUpperCase);
        log.info("[测试Function当作参数] {}", result);
    }

    

    public String testUseFunction(String content, Function<String, String> function) {
        return function.apply(content);
    }


    public void test() {
        // sfdasfasdfa 撒发射点发顺丰的fasfa fasfasf
//        asfasdfasdf
    }
}
